package support.limit.service.impl;

import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import support.limit.model.LimitDTO;
import support.limit.ratelimit.AbstractRateLimiter;
import support.limit.service.RateLimitAlgorihm;

import javax.annotation.Resource;


/**
 * @author:bo
 * @email:
 * @date 2018/12/13 14:04
 * @introduce 计数器 限流
 **/
@Service
@DependsOn("rateLimiter")
public class CounterAlgorithmImpl implements RateLimitAlgorihm {

    @Resource
    private AbstractRateLimiter rateLimiter;

    @Override
    public void handler(LimitDTO limitDTO) {
        rateLimiter.rateLimit(key, limit, lrefreshInterval, tokenBucketStepNum, tokenBucketTimeInterva, message);
    }
}
